home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Container / Sources / Part.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  4.9 KB  |  161 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Part.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef PART_H
  11. #define PART_H
  12.  
  13. #ifndef FWPARTNG_H
  14. #include "FWPartng.h"
  15. #endif
  16.  
  17. #ifndef FWSELECT_H
  18. #include "FWSelect.h"
  19. #endif
  20.  
  21. #ifndef FWCOLOR_H
  22. #include "FWColor.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. //    Forward Declarations
  27. //========================================================================================
  28.  
  29. class FW_CContent;
  30. class FW_CGraphicContext;
  31. class FW_CMenuBar;
  32. class FW_CMenuEvent;
  33. class FW_CMouseEvent;
  34. class FW_CPresentation;
  35.  
  36. class CProxy;
  37. class CPartContent;
  38. class CContainerSelection;
  39.  
  40. //========================================================================================
  41. //    class CContainerPart
  42. //========================================================================================
  43.  
  44. class CContainerPart : public FW_CEmbeddingPart
  45. {
  46.   public:
  47.     FW_DECLARE_CLASS
  48.     FW_DECLARE_AUTO(CContainerPart)
  49.     
  50. //----------------------------------------------------------------------------------------
  51. //    Initialization/Destruction
  52. //
  53.   public:        
  54.     CContainerPart(ODPart* odPart);
  55.     virtual ~ CContainerPart();
  56.  
  57.     virtual void            Initialize(Environment* ev, ODStorageUnit* storageUnit, FW_Boolean fromStorage);
  58.     
  59. //----------------------------------------------------------------------------------------
  60. //    Inherited API
  61. //
  62.   public:
  63.     virtual FW_Handled            DoMenu(Environment* ev, 
  64.                                     const FW_CMenuEvent& theMenuEvent);
  65.     virtual FW_Handled            DoAdjustMenus(Environment* ev, 
  66.                                     FW_CMenuBar* menuBar, 
  67.                                     FW_Boolean hasMenuFocus, 
  68.                                     FW_Boolean isRoot);
  69.     
  70.     virtual FW_Handled            DoAbout(Environment* ev);
  71.  
  72.     virtual FW_CFrame*             NewFrame(Environment* ev,
  73.                                     ODFrame* odFrame, 
  74.                                     FW_CPresentation* presentation,
  75.                                     FW_Boolean fromStorage);
  76.                                     
  77.     virtual FW_CContent*        NewPartContent(Environment* ev);
  78.  
  79.     virtual void                EmbeddedFrameRemoved(Environment *ev, FW_MProxy* proxy);
  80.  
  81. //----------------------------------------------------------------------------------------
  82. //    New API
  83. //
  84.   public:    
  85.     void                AddProxyToPart(Environment* ev, CProxy* proxy);
  86.  
  87.     void                DetachProxy(Environment* ev, CProxy* proxy);
  88.     void                AttachProxy(Environment* ev, CProxy* proxy);
  89.  
  90.     void                DeleteProxy(Environment* ev, CProxy* proxy);
  91.     
  92.     CProxy*             WhichProxy(Environment* ev, 
  93.                                     FW_CGraphicContext& gc,
  94.                                     const FW_CPoint& where,
  95.                                     FW_Boolean hasToBeSelected) const;
  96.  
  97.     FW_CPoint            GetDrawingSize() const;
  98.     FW_CPresentation*    GetMainPresentation() const;
  99.     CPartContent*        GetPartContent() const;
  100.  
  101.     FW_CColor            GetBackgroundColor() const;
  102.     void                SetBackgroundColor(Environment* ev, const FW_CColor& newBackColor);
  103.  
  104. //----------------------------------------------------------------------------------------
  105. //    Data Members
  106. //
  107.   private:    
  108.     CPartContent*        fPartContent;
  109.  
  110.     CContainerSelection* fContainerSelection;    // Attention I don't own the selection the presentation is
  111.     FW_CPresentation*    fMainPresentation;
  112.  
  113.     FW_CPoint            fDrawingSize;
  114.     
  115.     FW_CColor            fBackgroundColor;
  116. };
  117.  
  118. //========================================================================================
  119. //    Inlines
  120. //========================================================================================
  121.  
  122. //----------------------------------------------------------------------------------------
  123. //    CContainerPart::GetPartContent
  124. //----------------------------------------------------------------------------------------
  125. inline CPartContent* CContainerPart::GetPartContent() const
  126. {
  127.     return fPartContent;
  128. }
  129.  
  130. //----------------------------------------------------------------------------------------
  131. //    CContainerPart::GetDrawingSize
  132. //----------------------------------------------------------------------------------------
  133. inline FW_CPoint CContainerPart::GetDrawingSize() const
  134. {
  135.     return fDrawingSize;
  136. }
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //    CContainerPart::GetMainPresentation
  140. //----------------------------------------------------------------------------------------
  141. inline FW_CPresentation* CContainerPart::GetMainPresentation() const
  142. {
  143.     return fMainPresentation;
  144. }
  145.  
  146. //----------------------------------------------------------------------------------------
  147. //    CContainerPart::GetBackgroundColor
  148. //----------------------------------------------------------------------------------------
  149. inline FW_CColor CContainerPart::GetBackgroundColor() const
  150. {
  151.     return fBackgroundColor;
  152. }
  153.  
  154. //----------------------------------------------------------------------------------------
  155. // CContainerPart_SetColor
  156. //----------------------------------------------------------------------------------------
  157.  
  158. void CContainerPart_SetColor(Environment* ev, void* refCon, short red, short green, short blue);
  159.  
  160. #endif
  161.